<template>
	<view>
		<uNavbar :title="titles" ></uNavbar>
		
<!-- 		<view class=" flex_Z">
			<view class="see" v-for="(item,index) in aaaList" :key="index" @click="goNextPage(item.id)">
				<image v-if="item.image" :src="item.image" mode="aspectFill"></image>
				<view class="see_btm flex_Z">
					<view class="see_tit flex_ld">
						<text>{{item.title}}</text>
						<text>{{item.create_time.slice(0,10)}}</text>
					</view>
					<text>{{item.title}}</text>
				</view>
			</view>
		</view> -->
		<view class="news_box ">
			<view class="news flex_ld" v-for="(item,index) in newsList" :key="index" @click="goNextPage(item.id)">
				<image :src="item.image" mode="aspectFill"></image>
				<view class="news_r flex_Z">
					<text class="c3">{{item.title}}</text>
					<text class="c6">{{item.small_text}}</text>
				</view>
			</view>

		</view>
		<!-- 暂无数据 / 加载更多 -->
		<noDatas :xxxList="newsList" :status="status"></noDatas>
	</view>
</template>

<script>
	import {articleList} from "../../api/index.js";
	export default {
		data() {
			return {
				page: 1,
				size: 10,
				ids:'',
				status: 'loadmore', //加载前值为loadmore，加载中为loading，没有数据为nomore
				titles:'',
				newsList:[],
				aaaList:[]
			}
		},
		onLoad(e) {
			this.ids = e.id
			this.titles = e.name
			this.initList()
		},
		methods: {
			// 初始化列表
			initList() {
				let data = {
					page:this.page,
					type:2,
					category_id:this.ids,
				}
				articleList(data).then(res => {
					console.log(11111,res);
					if (res.code == 1) {
						let list = res.data.data;
						this.newsList = this.page == 1 ? list : this.newsList.concat(list);
						console.log(this.newsList);
						if (list.length < this.size) this.status = 'nomore';
					}
				})
			},
			goNextPage(id){
				uni.navigateTo({
					url:'/pagesMy/activityCenter/courseVideo?id=' + id + '&name=' + this.titles
				})
			}
		},
		// 下拉刷新
		onPullDownRefresh() {
			console.log('下拉刷新');
			let that = this;
			setTimeout(function() {
				that.page = 1,
				that.search = '',
				that.newsList = [],
				that.initList()
			}, 800);
		},
		//触底加载
		onReachBottom() {
			console.log('触底加载');
			if (this.status != 'nomore') {
				this.page = this.page + 1
				this.initList()
			}
		}
	}
</script>

<style scoped>

	.see{
		width: 690rpx;
		/* height: 446rpx; */
		background: #2A2753;
		border-radius: 24rpx 24rpx 24rpx 24rpx;
		margin: 0 auto 32rpx;
		padding-bottom: 30rpx;
	}
	.see>image{
		width: 690rpx;
		height: 280rpx;
		border-radius: 24rpx 24rpx 0rpx 0rpx;
	}
	.see_btm{
		width: 100%;
		
	}
	.see_btm>text{
		color: #A6A5AF;
		font-size: 24rpx;
		margin: 0 24rpx;
		text-overflow:ellipsis;
		display:-webkit-box;
		-webkit-box-orient:vertical; 
		-webkit-line-clamp:2; 
		overflow:hidden; 
	}
	.see_tit{
		padding: 24rpx 24rpx 8rpx;
	}
	.see_tit>text:nth-child(1){
		width: 75%;
		text-overflow:ellipsis;
		display:-webkit-box;
		-webkit-box-orient:vertical; 
		-webkit-line-clamp:1; 
		overflow:hidden; 
		font-size: 30rpx;
		font-weight: 700;
		color: #ffffff;
	}
	.see_tit>text:nth-child(2){
		width: 25%;
		text-align: right;
		font-size: 24rpx;
		color: #A6A5AF;
	}
	.news_box{
		display: flex;
		flex-direction: column;
		width: 100%;
		/* min-height: 580rpx; */
		/* background: #2A2753; */
	}
	.news{
		width: 100%;
		margin: 20rpx 0;
		padding: 0 40rpx;
	}
	.news>image{
		width: 230rpx;
		height: 144rpx;
		border-radius: 18rpx;
	}
	.news_r{
		width: 60%;
	}
	.news_r>text:nth-child(1){
		text-overflow:ellipsis;
		display:-webkit-box;
		-webkit-box-orient:vertical; 
		-webkit-line-clamp:1; 
		overflow:hidden; 
		font-size: 30rpx;
		font-weight: 700;
	}
	.news_r>text:nth-child(2){
		font-size: 24rpx;
		text-overflow:ellipsis;
		display:-webkit-box;
		-webkit-box-orient:vertical; 
		-webkit-line-clamp:2; 
		overflow:hidden; 
		margin-top: 20rpx;
	}
	
	

</style>